﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Logon.aspx.vb" Inherits="LinhKienMayTinh.Logon" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Chomaytinh | Logon</title>
    <script src="<%=ResolveUrl("~/") %>Scripts/jquery-1.8.3.js" type="text/javascript"></script>
    <style type="text/css">       
        body
        {
            text-align: center;
            background-color: #E1E1E1;
        } 
        #logon-form
        {         
            background-color: White;
            margin-top: 200px;   
            display: inline-block;
            padding: 10px 40px 10px 40px;
            border: 4px solid cyan;
            border-radius: 10px;
            font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;
            font-weight: bold;
        }
        .title
        {            
            margin-bottom: 20px;
        }
        table
        {
            width: 270px;
        }
        table .label
        {
            text-align: right;
            width: 30%;
        }
        table .control
        {
            text-align: left;
            padding-left: 5px;
            width: 70%;
        }
        table .control input
        {            
            width: 80%;
        }
        table .button-submit
        {
            text-align: left;
            padding-left: 5px;            
        }
        .error
        {
            text-align: left;
            padding-left: 5px;
            color: Red;
            font-size: 0.8em;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {                                   
            $("#frmLogon").on("submit", function (e) {                
                var xUsername = $("#<%=txtUsername.ClientID %>").val();
                var xPassword = $("#<%=txtPassword.ClientID %>").val();

                //clear error
                $("#<%=lbUsernameError.ClientID %>").text("");
                $("#<%=lbPasswordError.ClientID %>").text("");

                // check username rỗng
                if (xUsername.length == 0) {
                    $("#<%=lbUsernameError.ClientID %>").text("ID không được rỗng.");
                    e.preventDefault();
                    return;
                }
                // check password rỗng
                if (xPassword.length == 0) {
                    $("#<%=lbPasswordError.ClientID %>").text("Password không được rỗng.");
                    e.preventDefault();
                    return;
                }
            });

            $("#<%=txtUsername.ClientID %>").focus();            
        });
    </script>
</head>
<body>
    <form id="frmLogon" runat="server">
    <div id="logon-form">
        <div class="title">Đăng nhập</div>
        <table cellpadding="0" cellspacing="0" align="center" >
            <tr>
                <td class="label">
                    ID
                </td>
                <td class="control">
                    <asp:TextBox ID="txtUsername" runat="server" MaxLength="20"></asp:TextBox>                    
                </td>
            </tr>
            <tr>
                <td class="label">                    
                </td>
                <td class="error">
                    <asp:Label ID="lbUsernameError" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="label">
                    Password
                </td>
                <td class="control">
                    <asp:TextBox ID="txtPassword" TextMode="Password" runat="server"  MaxLength="20"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="label">                    
                </td>
                <td class="error">
                    <asp:Label ID="lbPasswordError" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="label">                    
                </td>
                <td class="button-submit">
                    <input id="btnSubmit" type="submit" value="Logon" />
                </td>
            </tr>
        </table>
        <asp:Label ID="lbErrorSumary" runat="server" CssClass="error"></asp:Label>
    </div>
    </form>
</body>
</html>
